{extend name="index_layout"/}
{block name="main"}
<link href="/static/libs/formSelects-v4.css" rel="stylesheet" />
<script src="/static/libs/formSelects-v4.js"></script>
<form class="layui-form">
    <div class="layui-form-item" id="extra_{$k}">
        <label class="layui-form-label"><span class="bitian">*</span>分配权限</label>
        <div class="layui-input-block">
            <select name="fenpei" id="" class="mutiple-select" xm-select-search=""  xm-select="userDetailOrganizationSelectId">
                {volist name="userlist" id="item"}
                <option value="{$item.id}">{$item.nickname}</option>
                {/volist}
            </select>
        </div>
    </div>
    <input type="hidden" value="{$id}" name="id">
    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter='ds' type="button" data-refresh="false">立即提交</button>
            <button class="layui-btn layui-btn-normal" type="button" onclick="var index1 = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index1);">返回</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script>
    layui.formSelects.render('userDetailOrganizationSelectId', {
        skin: "normal", //多选皮肤normal|primary|default|danger|warm
        height: "auto",                //是否固定高度, 38px | auto
        radio: false,                  //是否设置为单选模式
        direction: "down",        //显示方式向下显示
        on: function(id, vals, val, isAdd, isDisabled){
        },            //同formSelects.on
    })
    layui.use(['form'], function() {
        var form = layui.form;
        form.on('submit(ds)',function(data){
            $.post('{:url("fenpei")}',data.field,function(){
                layer.msg('分配成功');
                setTimeout(() => {
                    var index1 = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index1);
                    parent.location.reload();
                }, 500);

            },'json')
        })
    })
</script>
{/block}